<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j">           


<ui:composition template="/resources/jsf/component/include/default.xhtml">
    
    <ui:define name="head">
        <ui:include src="/resources/jsf/component/composition/system/css/default.xhtml" />
        <ui:include src="/resources/jsf/component/composition/system/javascript/fancyBox.xhtml" />
    </ui:define>
    
    <ui:define name="left-content" >
        <ui:include src="/resources/jsf/component/composition/user/profile/view-profile-user.xhtml" />
    </ui:define>

    <ui:define name="content">
        <h2>Sua Parte </h2> 
        <p><h:link value="+ novo produto" outcome="/user/product/add-product" /></p>
        
        <h:form rendered="#{not empty userc.userb.user.products}">
            <h:dataTable value="#{userc.userb.user.products}" var="p">
                <h:column>                
                    <f:facet name="header">Produto(s)</f:facet>                
                    <h:outputText value="#{p.name}" /> 
                </h:column>
                <h:column>                                             
                    <h:commandButton value="editar" action="#{productc.edit(p)}" />
                </h:column>
                <h:column>
                    <h:commandButton value="excluir" action="#{productc.delete(p)}" />
                </h:column>
            </h:dataTable>
            
        </h:form>                          
        <h:panelGroup rendered="#{productc.edit}">
            <h3>Editar produto </h3>
            <ui:include src="/resources/jsf/component/composition/user/product/edit-product.xhtml" />
        </h:panelGroup>
        
        <h:panelGroup rendered="#{empty userc.userb.user.products}" >
            <p>Você não possui nenhum produto, <h:link value="cadastre" outcome="/user/product/add-product" /> um para solicitar o produto que você precisa ou o produto que quer doar/trocar. </p>
        </h:panelGroup>
        
        <br/>
        <br/>            
        <h:link value="Voltar" outcome="/user/home.xhtml"/>
       
       <ui:include src="/resources/jsf/component/composition/system/popup-product.xhtml" /> 
    </ui:define> 
        
    <ui:define name="right-content" />

</ui:composition>
</html>